//
//  CDCollections.m
//  freeLance
//
//  Created by s.zalozniy on 3/29/13.
//  Copyright (c) 2013 Mozi Development. All rights reserved.
//

#import "CDCollections.h"
#import "CDCategories.h"
#import "CDImages.h"
#import "CDProducts.h"


@implementation CDCollections

@dynamic ident;
@dynamic category_id;
@dynamic image_id;
@dynamic name;
@dynamic isSynchronized;
@dynamic category;
@dynamic image;
@dynamic products;

#pragma mark - Allocators

+(CDCollections *) colletionWithCollectionInfo:(Collections *)collectionInfo inContext:(NSManagedObjectContext *)context {
    CDCollections *newCollection = [NSEntityDescription insertNewObjectForEntityForName:[[CDCollections class] description]
                                                       inManagedObjectContext:context];
    [newCollection updateWithCollecionInfo:collectionInfo inContext:context];
    
    return newCollection;
}


#pragma mark - Interface methods

-(void) updateWithCollecionInfo:(Collections *)collectionInfo inContext:(NSManagedObjectContext *)context {
    self.ident = collectionInfo.ident;
    self.category_id = collectionInfo.category_id;
    self.image_id = collectionInfo.image_id;
    self.name = collectionInfo.name;
    self.isSynchronized = [NSNumber numberWithBool:YES];
}

@end
